package com.ithe.canteen.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Random;

public class CreatIDUtil {

    public static String createID(String prefixStr) {
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmms");
        String timestamp = now.format(formatter);
        Random random = new Random();
        int randomNumber = random.nextInt(100); // 生成0到99的随机数
        String randomStr = String.format("%02d", randomNumber);
        return prefixStr + timestamp + randomStr;
    }

}
